<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<include file='Common:head'/>
<script>
	$(function(){
		$('input[level=1]').click(function(){
			var inputs = $(this).parents('.app').find('input');
			$(this).attr('checked')?inputs.attr('checked','checked'):inputs.removeAttr('checked');
		});
		$('input[level=2]').click(function(){
			var inputs = $(this).parents('dl').find('input');
			$(this).attr('checked')?inputs.attr('checked','checked'):inputs.removeAttr('checked');
		});
	});
</script>
<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>首页</li>
    <li>配置权限</li>
  </ul>
</div>
<form action="{:U('Rbac/setAccess')}" method="post">
  <div id="wrap"> <a href="{:U('Rbac/role')}" class="add-app">返回</a>
    <foreach name="node" item="app">
      <div class="app">
        <p> <strong>{$app['remark']}({$app['name']})</strong>
          <input type="checkbox" name="access[]" value="{$app['id']}_1" level="1" 
          <if condition="$app['access']">checked='checked'</if> />
        </p>
        <foreach name="app.child" item="action">
          <dl>
            <dt> <strong>{$action['remark']} ({$action.name})</strong>
              <input type="checkbox" name="access[]" value="{$action['id']}_2" level="2" 
              <if condition="$action['access']">checked='checked'</if> />
            </dt>
            <foreach name="action.child" item="metod">
              <dd> 
              <span style="font-weight:bold">
              <input type="checkbox" name="access[]" value="{$metod['id']}_3" level="3" 
              <if condition="$metod['access']">checked='checked'</if> />
              	{$metod['remark']}({$metod['name']})</span>
		      </dd>
            </foreach>
          </dl>
        </foreach>
      </div>
    </foreach>
  </div>
  <input type="submit" value="保存提交" style=" display:block; width:100px; height:40px; line-height:20px; background:#FFF; color:#666; border:1px solid #999; font-size:16px; margin-left:auto; margin-right:auto;cursor:pointer;">
  <input type="hidden" name="rid" value="{$rid}">
</form>
</body>
</html>
